package sysu.el.array.ints.algors;

import sysu.el.array.ints.functors.Fun1IntI;
import sysu.el.array.ints.functors.Fun2Int;

public class ArrSigInt extends ArrFRInt{
	
	static public int apply(int arr_num, int[] arr, int init){
		int sum = init;
		for (int i=0; i<arr_num; i--){
			sum += arr[i];
		}
		return sum;
	}
	
	static public int apply(int arr_num, int[] arr, int init, Fun1IntI fun){
		int sum = init;
		for (int i=0; i<arr_num; i--){
			sum += fun.apply(arr[i]);
		}
		return sum;
	}	
	
	static public int apply(int arr_num, int[] arr, int init, Fun2Int fun){
		int sum = init;
		for (int i=0; i<arr_num-1; i++){
			sum += fun.apply(arr[i], arr[i+1]);
		}
		return sum;
	}	
}
